<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
    <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt"%>
<%@ page import="java.util.List"%><%@ page import="java.util.Arrays"%>
<%@ page import="java.sql.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script type="text/javascript">


function populatedropdown(dayfield, monthfield, yearfield){
var today=new Date()
var dayfield=document.getElementById(dayfield)
var monthfield=document.getElementById(monthfield)
var yearfield=document.getElementById(yearfield)
for (var i=1; i<=31; i++)
dayfield.options[i]=new Option(i, i+1)
dayfield.options[today.getDate()]=new Option(today.getDate(), today.getDate(), true, true) //select today's day
for (var m=0; m<12; m++)
monthfield.options[m]=new Option(monthtext[m], monthtext[m])
monthfield.options[today.getMonth()]=new Option(monthtext[today.getMonth()], monthtext[today.getMonth()], true, true) //select today's month
var thisyear=today.getFullYear()
for (var y=0; y<20; y++){
yearfield.options[y]=new Option(thisyear, thisyear)
thisyear+=1
}
yearfield.options[0]=new Option(today.getFullYear(), today.getFullYear(), true, true) //select today's year
}

</script>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<style type="text/css">
body
{
background-color: #FFE4E1;
}
</style>
<script type="text/javascript">
function validateForm()
{
	var validformat=/^\d{2}\/\d{2}\/\d{4}$/; //Basic check for format validity
	 var returnval=false;
	var valid=true;
	 var numericExpression = /^[0-9]+$/;
    
    if(document.myForm.eventName.value=="")
    {
    	valid=false;
    	alert("eventName shouldnot be left blank");
    }
    else if(document.myForm.classSize.value=="")
    {
    	valid=false;
    	alert("classSize shouldnot be left blank");
    }
    else if(isNaN(myForm.classSize.value)) 
    { 
    	valid=false;
        alert("Invalid data format.\n\nOnly numbers are allowed."); 
         
      }
    else if(document.myForm.fees.value=="")
    {
    	valid=false;
    	alert("Fees shouldnot be left blank");
    }
    else if(isNaN(myForm.fees.value)) 
    { 
    	valid=false;
        alert("Invalid data format.\n\nOnly numbers are allowed."); 
         
      }
    else if(document.myForm.locationId.value=="")
    {
    	valid=false;
    	alert("Select Location");
    }
    else if(document.myForm.speakerName.value=="")
    {
    	valid=false;
    	alert("Select Speaker");
    }
    else if(document.myForm.promotion.value=="")
    {
    	valid=false;
    	alert("Select promotion");
    }
    else{
    	
    	alert("form validated..");
    	window.location.href="/EventManagementSystem/GetEvent";
    }
    return valid;
}
 function cancelForm(){
	 window.location.href="/EventManagementSystem/GetEvent";
 }
 
	  
</script>
</head>
<body>
<%@include file="header.jsp"%>
<%@include file="Page.jsp" %>
<form name="myForm" action="GetEvent" onsubmit="return validateForm()" >
<center>
<h1>Modify Existing Events</h1>
</center>
<table border="1" align="center">
	<tr>
		
		<td><input type="hidden" name="eventId" value="${i.eventId}" /><input type="hidden" name="modify" value="${i.eventId}"  /></td>
	</tr>
	
	<tr>
		
		<td><input type="hidden" name="modify" value="yes"  /></td>
	</tr>
	<tr>
		<td>Enter Event Name :</td>
		<td><input type="text" name="eventName" value="${i.eventName}" /></td>
	</tr>
	<tr>
				<td>Enter Start Date :</td>
				<td><select name="day">
				</select> <select name="month">
				</select> <select name="year">
				</select></td>

			</tr>
			<tr>
				<td>Enter End Date :</td>
				<td><select name="day1">
				</select> <select name="month1">
				</select> <select name="year1">
				</select></td>



			</tr>
	<tr>
		<td>Enter classSize:</td>
		<td><input type="text" name="classSize" value="${i.classSize}"/></td>
	</tr>
	<tr>
		<td>Enter fees:</td>
		<td><input type="text" name="fees" value="${i.fees}"/></td>
	</tr>
	<tr>
		<tr>
				<td>Select Location :</td>
				<td><select name="locationId">
						<option value="">Select One</option>
						<option value="1">Kerala</option>
						<option value="2">Bangalore</option>
						<option value="3">Chennai</option>

				</select>
				</td>
			</tr>
			<tr>
				<td>Select Speaker :</td>
				<td><select name="speakerName">
						<option value="">Select One</option>
						<option value="1">Rahul</option>
						<option value="2">Vinodh</option>
						<option value="3">Vijay</option>
						<option value="4">Swapna</option>

				</select>
				</td>
			</tr>
			<tr>
				<td>Select Promotion :</td>

				<td><select name="promotionId">
						<option value="">Select One</option>
						<option value="1">General</option>
						<option value="2">Quota</option>
						<option value="3">NA</option>

				</select>
				</td>
			</tr>

	
</table>
<br>
		<br>
		<center>
			<input type="submit" value="submit" /> <input type="reset" /><input
				type="button" value="Cancel" onClick="cancelForm()" />

		</center>


</form>
<script type="text/javascript">
//populatedropdown(id_of_day_select, id_of_month_select, id_of_year_select)
window.onload=function(){
populatedropdown("day", "month", "year")
populatedropdown("day1", "month1", "year1")
}

</script>


<%@include file="Footer.jsp"%>
</body>
</html>